-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unified renderer #143
Unified renderer #143
Conversation
Unfortunately #79 still an issue. Tested with 7791c49 Fails soon after injection when it can't lock the render engine, with a bunch of WndProc lock fails before.
|
--------- Co-authored-by: thoxy <[email protected]>
@camas I stalked your GitHub and noticed you are using Weirdly enough, there is only 3 places now where the render engine is locked that could create contention: My hunch there is that the wnd proc calls itself recursively, locks once and is not ever able to exit and do anything else. Or the |
I have gotten some feedback and will now merge this in as there are no apparent regressions for the time being. |
Thanks for the ping, feel free to ping me whenever as I'm more than happy to test out features whenever I can. I'll update to the latest commit, fix a few errors due to the changes and then test it in both OpenGL and then later DirectX9, will let you know how it goes 👍🏽 |
Thank you 🙏 |
This is a MASSIVE refactor that completely changes the underlying rendering engine, which is now a unified DirectX12 renderer that is then composited over games' windows via DirectComposition, with barely any public API change.
It seamlessly works with Dark Souls III and Elden Ring already, and the integration test cases.
Being such a breaking change, I will shamelessly ping all people that may be affected as I don't have a lot of control over corner cases but really don't want to merge this in before I'm sure I'm not disrupting anything. I would be super grateful if you'd be up for checking this out. I expect some of you may have moved on to other projects, in that case I hope you won't be annoyed by the ping!
Explanation
This PR implements a DirectX 12 renderer in
hudhook::renderer::dx12
which renders over an off-screen surface, and then uses DirectComposition to composite the off-screen surface on top of the HWND, completely sidestepping the games' native rendering engine which will run on its own.Present
hooks now only serve the purpose of actually triggering a render and a composition and the device objects aren't touched at all. In fact, most of the hooks' rendering logic except building the actual hooked function implementations is now shared and identical across all hooks.As a result, hooks are now tiny compared to what they were before and their maintenance is going to be very easy. Similarly, with a single renderer there is much less code to maintain.
Additionally, this will make it extremely simple to add new renderers
Affected issues
As a bonus, this PR should fix the following issues, or at the very least give us a cleaner path to their resolution.
If you are getting pinged, it would mean the world if you could give this branch a spin and report back if it fixed the associated issue.
@Godnoken @camas since the renderer does not lock DirectX9 specific resources, it could alleviate/solve the issue. (need to investigate)
@Godnoken I have found a different way of blocking input that doesn't involve rerouting many input functions: just use a transparent overlay window. It's not implemented but I think we could explore that avenue and it could work for all hooks.
@Godnoken this branch uses
WM_SIZE
for resize events which should sidestep everything that causes your issue altogether. (might close the issue)@earthnuker @SkyLeite this greatly reduces the issue surface; now that the hook code is drastically simpler, we could try a number of solutions, provided this one somehow doesn't solve the issue already. (need to investigate)
wgpu
renderer #111.We won't need a renderer with multiple backends after all!
@vars1ty not sure about the specific game, but maybe things may have changed enough that this now works correctly. (need to investigate)
@Thoxy67 this branch should most definitely work for you now.
Thank you all for your patience and sorry again for the ping! 😅